<%@ page contentType="text/html;charset=utf-8" %>
<%@ page import="java.util.*" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function deleteRow(obj) {
		$(obj).parent().parent().next().remove();
		$(obj).parent().parent().remove();
	}
	
function add_new() {
		var game_download_url_obj = "<tr><td><input  type='hidden' name='feed_id' value='' maxlength='100' /></td><td>名称&nbsp;<input  type='text' name='feed_title' value='' size='24' maxlength='80' /></td><td>图片&nbsp;<input onclick='openUpload(this)' style='cursor:pointer'  readonly  type='text' name='feed_image' value='' size='30' maxlength='100' /></td><td>跳转&nbsp;<input  type='text' name='feed_url' value='' size='30' maxlength='100' /></td><td>开启&nbsp;<input  type='text' name='feed_enable' value='' size='4' maxlength='20' /></td><td><input style='border:1px #333 solid' onclick='deleteRow(this)'  value='删除' type='button' /></td></tr><tr><td colspan='3'>&nbsp;</td></tr>";
		var game_downloads_urls = $("#homePagePicCfgs").html() + game_download_url_obj;
		$("#homePagePicCfgs").html(game_downloads_urls);
	}
	
function save() {
		document.getElementById("picform").action = "gameManage.do?pm=insertPagePicCfg";
		//TODO:需要验证下参数
		document.getElementById("picform").submit();
	}
	
/****************图片上传组件**************/
	function openUpload(obj){
	 	 var windowStatus = "dialogWidth:400px; dialogHeight:360px; center:yes; resizable:no; scroll:no; status:no; help:no; ";
	 	 var url = "common.do?pm=gotoUpload";
	 	 var returnValue = window.showModalDialog(url,"",windowStatus);
	 	 if(returnValue!=undefined){
	 		 obj.value=returnValue;
	 	 }
	}
	/*****************图片上传组件END****************/
</script>
<form  method="post" name="picform" id="picform">
<style type="text/css">
input {
	border: 1px #ccc solid;
}
</style>
<%
List<Map> homePagePicCfgList=(List<Map>)request.getAttribute("homePagePicCfgList");
%>
<div class="content-box-header">
					<h3>首页图片配置</h3>
					<div class="clear"></div>
				</div> 
                <div class="content-box-content">
               	  	<table id="homePagePicCfgs">
               	  		<% 
               	  			if(homePagePicCfgList!=null && homePagePicCfgList.size()>0){
               	  			for(int t=0;t<homePagePicCfgList.size();t++){
               	  		%>
             			<tr>
             				<td><input  type='hidden' name='feed_id' value='<%=homePagePicCfgList.get(t).get("feed_id") %>' maxlength='100' /></td>
             				<td>名称&nbsp;<input  type='text' name='feed_title' value='<%=homePagePicCfgList.get(t).get("feed_title") %>' size='24' maxlength='80' /></td>
             				<td>图片&nbsp;<input  onclick='openUpload(this)' style='cursor:pointer'  readonly type='text' name='feed_image' value='<%=homePagePicCfgList.get(t).get("feed_image") %>' size='30' maxlength='100' /></td>
             				<td>跳转&nbsp;<input  type='text' name='feed_url' value='<%=homePagePicCfgList.get(t).get("feed_url") %>' size='30' maxlength='100' /></td>
             				<td>开启&nbsp;<input  type='text' name='feed_enable' value='<%=homePagePicCfgList.get(t).get("feed_enable") %>' size='4' maxlength='20' /></td>
             				<td><input style='border:1px #333 solid' onclick='deleteRow(this)'  value='删除' type='button' /></td>
             			</tr><tr><td colspan='3'>&nbsp;</td></tr>
               	  		<%
               	  		}}
               	  		%>
                  	</table>
                </div>
                <div style="text-align:right;margin-bottom: 4px"><span style='color:red'>先新增好再逐个赋值，不要新增一个赋值一个，不然会有问题！&nbsp;&nbsp;</span><input  style="border:solid 1px #000;width:160px;cursor:pointer;height:40px" type="button" onmousemove=(this.style.background='#57a000') onmouseout=(this.style.background='#FFF')   value="新增" onclick="add_new()" type="button"/>&nbsp;<input  style="border:solid 1px #000;width:160px;cursor:pointer;height:40px" type="button" onmousemove=(this.style.background='#57a000') onmouseout=(this.style.background='#FFF')   value="保存配置" onclick="save()" type="button"/></div>
</form>            